package io.kiki.sba.registry.util;

import java.sql.Timestamp;


public final class TimestampUtil {
    private TimestampUtil() {
    }

    public static long getNanosLong(Timestamp timestamp) {
        return timestamp.getTime() / 1000 * 1000000000 + timestamp.getNanos();
    }

    public static Timestamp fromNanosLong(long nanos) {
        Timestamp ts = new Timestamp(nanos / 1000000);
        ts.setNanos((int) (nanos % 1000000000));
        return ts;
    }
}
